#include "GAF_Utility.h"

namespace GAF
{
	int Math::Distance(int nX1, int nY1, int nX2, int nY2)
	{
//		return (int)_hypot((float)GAF_MATH_ABS(nX1 - nX2), (float)GAF_MATH_ABS(nY1 - nY2));
		return 0;
	}

	int Math::Way(int nBeginX, int nBeginY, int nEndX, int nEndY)
	{
		double _dRadian = atan2((double)GAF_MATH_ABS(nBeginX - nEndX), (double)GAF_MATH_ABS(nBeginY - nEndY));
		int _nAngle = (int)GAF_MATH_RADIAN2ANGLE(_dRadian);

		if(nEndX >= nBeginX)
		{ // 在第一和第二象限
			if(nEndY >= nBeginY)
			{ // 第二象限
				_nAngle = 180 - _nAngle;
			}
		}
		else
		{ //在第三和第四象限
			if (nEndY > nBeginY)
			{ //第三象限
				_nAngle = 180 + _nAngle;
			}
			else
			{ //第四象限
				_nAngle = 360 - _nAngle;
			}
		}

		return _nAngle;
	}


}
